package com.ctshk.rpc.order.goods.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ctshk.rpc.goods.req.ShoppingSpecialPageReq;
import com.ctshk.rpc.order.goods.dto.ShoppingSpecialPageDTO;
import com.ctshk.rpc.order.goods.entity.ShoppingSpecial;
import com.ctshk.rpc.order.goods.mapper.provider.ShoppingSpecialProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

/**
 * <p>
 * 商城专题 Mapper 接口
 * </p>
 *
 * @author 姜斌文
 * @since 2021-04-30
 */
public interface ShoppingSpecialMapper extends BaseMapper<ShoppingSpecial> {

    @SelectProvider(type = ShoppingSpecialProvider.class, method = "findShoppingSpecialPageByCondition")
    IPage<ShoppingSpecialPageDTO> findShoppingSpecialPageByCondition(IPage<ShoppingSpecialPageDTO> page, ShoppingSpecialPageReq pageReq);

    /**
     * 根据id查询专题信息
     * @param id
     * @return
     */
    @Select({
            "SELECT id,special_topics,special_picture_url,special_title,sort,is_display,web_special_picture_url," +
                    "app_special_picture_url,create_id,modified_id,is_deleted,operator_id,gmt_create,gmt_modified " +
                    "FROM `ctshk-goods`.t_shopping_special " +
                    "WHERE id=#{id}"
    })
    ShoppingSpecial selectShoppingById(@Param("id") Long id);

    /**
     * 查询商店信息
     * @return
     */
    @Select({
            "SELECT  id,special_topics,special_picture_url,special_title,sort,is_display,web_special_picture_url," +
                    "app_special_picture_url,create_id,shopping_shop_id,modified_id,is_deleted,operator_id,gmt_create,gmt_modified  " +
                    "FROM `ctshk-goods`.t_shopping_special where shopping_shop_id =\"77446082962915328\""
    })
    List<ShoppingSpecial> selectAllList();

}
